<template>
	<view >
		<uni-nav-bar  @clickLeft="back" :fixed="true"  :border="false" shadow status-bar left-icon="left" left-text="返回" title="投诉与建议" />
		
		<view class="uni-textarea" style="margin: 40rpx;border: 1px solid #999999aa; border-radius: 12rpx; padding: 20rpx;">
			<textarea v-model="text" placeholder-style="color:#ccc" placeholder="请输入投诉与建议"/>
		</view>
		
		<button @click="submit" style="margin: 40rpx; background-color: #4461e2;color: #fff;" >提交</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				text: ''
			}
		},
		methods: {
			back(){
				// window.location.href ='/#/pages/home/home'
				window.location.href ='\\approve/#/prodLis'
				// window.open('\\approve/#/prodList', "_top")
			},
			async submit(){
				if (!this.text) {
					uni.showToast({
						title: '请输入投诉与建议',
						icon: 'error'
					})
					return
				}
				uni.showLoading({
					title: '提交中...'
				})
				try{
					const resGetUserInfo = await this.$myRequest({
						url: 'api/member/getUserInfo',
						method: 'post',
						data: {
						}
					});
					const tokenMobile = resGetUserInfo.mobile;
					const res = await this.$myRequest({
						url: 'api/member/feedback',
						method: 'post',
						data: {
							mobile: tokenMobile,
							content: this.text
						}
					});
					uni.showToast({
						title: '提交成功',
						icon: 'success'
					})
					setTimeout(() => {
						this.back()
					}, 1000)
				}catch(e){}
				uni.hideLoading()
			}
		}
	}
</script>

<style>
</style>
